home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / TranslationExtensions.h < prev    next >
Text File  |  1995-07-06  |  6KB  |  186 lines

  1. /*
  2.      File:        TranslationExtensions.h
  3.  
  4.      Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5.  
  6.      Version:    Technology:    Macintosh Easy Open 1.1
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __TRANSLATIONEXTENSIONS__
  21. #define __TRANSLATIONEXTENSIONS__
  22.  
  23. #define kSupportsFileTranslation        1
  24. #define kSupportsScrapTranslation        2
  25. #define kTranslatorCanGenerateFilename    4
  26.  
  27. #ifndef REZ
  28.  
  29. #ifndef __MEMORY__
  30. #include <Memory.h>
  31. #endif
  32. /*    #include <Types.h>                                            */
  33. /*        #include <ConditionalMacros.h>                            */
  34. /*    #include <MixedMode.h>                                        */
  35.  
  36. #ifndef __FILES__
  37. #include <Files.h>
  38. #endif
  39. /*    #include <OSUtils.h>                                        */
  40. /*    #include <Finder.h>                                            */
  41.  
  42. #ifndef __QUICKDRAW__
  43. #include <Quickdraw.h>
  44. #endif
  45. /*    #include <QuickdrawText.h>                                    */
  46.  
  47. #ifndef __COMPONENTS__
  48. #include <Components.h>
  49. #endif
  50.  
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54.  
  55. #if PRAGMA_ALIGN_SUPPORTED
  56. #pragma options align=mac68k
  57. #endif
  58.  
  59. #if PRAGMA_IMPORT_SUPPORTED
  60. #pragma import on
  61. #endif
  62.  
  63. typedef OSType FileType;
  64.  
  65. typedef ResType ScrapType;
  66.  
  67. typedef unsigned long TranslationAttributes;
  68.  
  69.  
  70. enum {
  71.     taDstDocNeedsResourceFork    = 1,
  72.     taDstIsAppTranslation        = 2
  73. };
  74.  
  75. struct FileTypeSpec {
  76.     FileType                        format;
  77.     long                            hint;
  78.     TranslationAttributes            flags;                        /* taDstDocNeedsResourceFork, taDstIsAppTranslation*/
  79.     OSType                            catInfoType;
  80.     OSType                            catInfoCreator;
  81. };
  82. typedef struct FileTypeSpec FileTypeSpec;
  83.  
  84. struct FileTranslationList {
  85.     unsigned long                    modDate;
  86.     unsigned long                    groupCount;
  87. /*     unsigned long    group1SrcCount;*/
  88. /*     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);*/
  89. /*  FileTypeSpec    group1SrcTypes[group1SrcCount]*/
  90. /*  unsigned long    group1DstCount;*/
  91. /*  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);*/
  92. /*  FileTypeSpec    group1DstTypes[group1DstCount]*/
  93. };
  94. typedef struct FileTranslationList FileTranslationList;
  95.  
  96. typedef FileTranslationList *FileTranslationListPtr, **FileTranslationListHandle;
  97.  
  98. struct ScrapTypeSpec {
  99.     ScrapType                        format;
  100.     long                            hint;
  101. };
  102. typedef struct ScrapTypeSpec ScrapTypeSpec;
  103.  
  104. struct ScrapTranslationList {
  105.     unsigned long                    modDate;
  106.     unsigned long                    groupCount;
  107. /*     unsigned long        group1SrcCount;*/
  108. /*     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);*/
  109. /*  ScrapTypeSpec        group1SrcTypes[group1SrcCount]*/
  110. /*  unsigned long        group1DstCount;*/
  111. /*     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);*/
  112. /*  ScrapTypeSpec        group1DstTypes[group1DstCount]*/
  113. };
  114. typedef struct ScrapTranslationList ScrapTranslationList;
  115.  
  116. typedef ScrapTranslationList *ScrapTranslationListPtr, **ScrapTranslationListHandle;
  117.  
  118. /* definition of callbacks to update progress dialog*/
  119. typedef long TranslationRefNum;
  120.  
  121. /*****************************************************************************************
  122. *
  123. * This routine sets the advertisement in the top half of the progress dialog.
  124. * It is called once at the beginning of your DoTranslateFile routine.
  125. *
  126. * Enter:    refNum            Translation reference supplied to DoTranslateFile.
  127. *            advertisement    A handle to the picture to display.  This must be non-purgable.
  128. *                            Before returning from DoTranslateFile, you should dispose
  129. *                            of the memory.  (Normally, it is in the temp translation heap
  130. *                            so it is cleaned up for you.)
  131. *
  132. * Exit:    returns            noErr, paramErr, or memFullErr
  133. */
  134. extern pascal OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
  135.  TWOWORDINLINE(0x7002, 0xABFC);
  136. /*****************************************************************************************
  137. *
  138. * This routine updates the progress bar in the progress dialog.
  139. * It is called repeatedly from within your DoTranslateFile routine.
  140. * It should be called often, so that the user will get feedback if he tries to cancel.
  141. *
  142. * Enter:    refNum        translation reference supplied to DoTranslateFile.
  143. *            progress    percent complete (0-100)
  144. *
  145. * Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  146. *            returns        noErr, paramErr, or memFullErr
  147. */
  148. extern pascal OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
  149.  TWOWORDINLINE(0x7001, 0xABFC);
  150. /* ComponentMgr selectors for routines*/
  151.  
  152. enum {
  153.     kTranslateGetFileTranslationList = 0,                        /* component selectors*/
  154.     kTranslateIdentifyFile,
  155.     kTranslateTranslateFile,
  156.     kTranslateGetTranslatedFilename,
  157.     kTranslateGetScrapTranslationList = 10,                        /* skip to scrap routines*/
  158.     kTranslateIdentifyScrap,
  159.     kTranslateTranslateScrap
  160. };
  161.  
  162. /* Routines to implment in a file translation extension*/
  163. typedef pascal ComponentResult (*DoGetFileTranslationListProcPtr)(ComponentInstance self, FileTranslationListHandle translationList);
  164. typedef pascal ComponentResult (*DoIdentifyFileProcPtr)(ComponentInstance self, const FSSpec *theDocument, FileType *docType);
  165. typedef pascal ComponentResult (*DoTranslateFileProcPtr)(ComponentInstance self, TranslationRefNum refNum, const FSSpec *sourceDocument, FileType srcType, long srcTypeHint, const FSSpec *dstDoc, FileType dstType, long dstTypeHint);
  166. typedef pascal ComponentResult (*DoGetTranslatedFilenameProcPtr)(ComponentInstance self, FileType dstType, long dstTypeHint, FSSpec *theDocument);
  167. /* Routine to implement in a scrap translation extension*/
  168. typedef pascal ComponentResult (*DoGetScrapTranslationListProcPtr)(ComponentInstance self, ScrapTranslationListHandle list);
  169. typedef pascal ComponentResult (*DoIdentifyScrapProcPtr)(ComponentInstance self, const void *dataPtr, Size dataLength, ScrapType *dataFormat);
  170. typedef pascal ComponentResult (*DoTranslateScrapProcPtr)(ComponentInstance self, TranslationRefNum refNum, const void *srcDataPtr, Size srcDataLength, ScrapType srcType, long srcTypeHint, Handle dstData, ScrapType dstType, long dstTypeHint);
  171.  
  172. #if PRAGMA_IMPORT_SUPPORTED
  173. #pragma import off
  174. #endif
  175.  
  176. #if PRAGMA_ALIGN_SUPPORTED
  177. #pragma options align=reset
  178. #endif
  179.  
  180. #ifdef __cplusplus
  181. }
  182. #endif
  183.  
  184. #endif /* REZ */
  185. #endif /* __TRANSLATIONEXTENSIONS__ */
  186.